package com.alkalinesolutions.json.core;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 * Class for looking up localized strings for things like error messages.
 * 
 * @author David Waite &lt;<a href='mailto:david@alkaline-solutions.com'>david@alkaline-solutions.com</a>&gt;
 */
public class Messages {
	private static final String BUNDLE_NAME = "com.alkalinesolutions.json.core.messages"; //$NON-NLS-1$

	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
			.getBundle(BUNDLE_NAME);

	private Messages() { /* Do not allow creation */
	}

	public static String getString(final String key) {
		try {
			return RESOURCE_BUNDLE.getString(key);
		} catch (final MissingResourceException e) {
			return '!' + key + '!';
		}
	}
}
